package com.dzsw.javabase.proxy.dynamic;

import com.dzsw.javabase.proxy.ISubject;
import com.dzsw.javabase.proxy.SubjectImpl;

import java.lang.reflect.Proxy;

public class DynamicProxyMain {

    public static void main(String[] args) {
        ISubject subject = new SubjectImpl();

        ISubject proxy = (ISubject) Proxy.newProxyInstance(
                subject.getClass().getClassLoader(),
                subject.getClass().getInterfaces(),
                new DynamicProxy(subject));
        proxy.doSomething("susan");
    }
}
